package com.meixiang.entity.shopping;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * 购物车店铺
 *
 * @author LZRUI
 */
public class CartStoreEntity implements Parcelable {

    private String storeId; // id
    private String storeName; // 店铺名称
    private String couponInfo; // 优惠信息
    private String couponTypeInfo; // 满减/立减
    private List<CartGoodsEntity> cartGoodsList; // 商品列表
    private boolean isSelected; //  是否选中

    public CartStoreEntity(String storeId, String storeName, String couponInfo, String couponTypeInfo, List<CartGoodsEntity> cartGoodsList) {
        this.storeId = storeId;
        this.storeName = storeName;
        this.couponInfo = couponInfo;
        this.couponTypeInfo = couponTypeInfo;
        this.cartGoodsList = cartGoodsList;
    }

    public CartStoreEntity() {
    }

    public String getStoreId() {
        return storeId == null ? "" : storeId;
    }

    public void setStoreId(String storeId) {
        this.storeId = storeId;
    }

    public String getStoreName() {
        return storeName == null ? "" : storeName;
    }

    public void setStoreName(String storeName) {
        this.storeName = storeName;
    }

    public List<CartGoodsEntity> getCartGoodsList() {
        return cartGoodsList;
    }

    public void setCartGoodsList(List<CartGoodsEntity> cartGoodsList) {
        this.cartGoodsList = cartGoodsList;
    }

    public String getCouponInfo() {
        return couponInfo == null ? "" : couponInfo;
    }

    public void setCouponInfo(String couponInfo) {
        this.couponInfo = couponInfo;
    }

    public String getCouponTypeInfo() {
        return couponTypeInfo == null ? "" : couponTypeInfo;
    }

    public void setCouponTypeInfo(String couponTypeInfo) {
        this.couponTypeInfo = couponTypeInfo;
    }

    public boolean isSelected() {
        return isSelected;
    }

    public void setSelected(boolean selected) {
        isSelected = selected;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.storeId);
        dest.writeString(this.storeName);
        dest.writeString(this.couponInfo);
        dest.writeString(this.couponTypeInfo);
        dest.writeTypedList(this.cartGoodsList);
        dest.writeByte(this.isSelected ? (byte) 1 : (byte) 0);
    }

    protected CartStoreEntity(Parcel in) {
        this.storeId = in.readString();
        this.storeName = in.readString();
        this.couponInfo = in.readString();
        this.couponTypeInfo = in.readString();
        this.cartGoodsList = in.createTypedArrayList(CartGoodsEntity.CREATOR);
        this.isSelected = in.readByte() != 0;
    }

    public static final Parcelable.Creator<CartStoreEntity> CREATOR = new Parcelable.Creator<CartStoreEntity>() {
        @Override
        public CartStoreEntity createFromParcel(Parcel source) {
            return new CartStoreEntity(source);
        }

        @Override
        public CartStoreEntity[] newArray(int size) {
            return new CartStoreEntity[size];
        }
    };

    @Override
    public String toString() {
        return "CartStoreEntity{" +
                "storeId='" + storeId + '\'' +
                ", storeName='" + storeName + '\'' +
                ", couponInfo='" + couponInfo + '\'' +
                ", couponTypeInfo='" + couponTypeInfo + '\'' +
                ", cartGoodsList=" + cartGoodsList +
                ", isSelected=" + isSelected +
                '}';
    }
}
